<?php
/**
 * 所有评论 - JBlog
 * 
 * @copyright (c) 2008-2010 JBlog (www.lisijie.org)
 * @author lisijie <lisijie86@gmail.com>
 * @version $Id: comments.php 536 2010-07-12 02:55:32Z lisijie86 $
*/

$page = max(1, intval($get['page']));
$pagesize = config('pagesize');
$offset = ($page-1) * $pagesize;
$url = 'mod=comments';
$count = $db->count('comment', " postid > 0 AND `status` = '1'");
$sql = "SELECT c.*,p.title,p.alias,p.`type` AS posttype FROM ".tname('comment')." c JOIN ".tname('post')." p 
ON c.postid = p.id WHERE c.`status` = '1' ORDER BY c.id DESC LIMIT $offset, $pagesize";
$_CACHE['comment'] = array();
$query = $db->query($sql);
while ( $row = $db->fetch_array($query) ) {
	$row['post_link'] = '<a href="'.url('mod='.($row['posttype']=='page'?'page':'post').'&id='.$row['postid'].'&alias='.$row['alias']).'">'.$row['title'].'</a>';
	$_CACHE['comment'][$row['id']] = $row;
}

blog('title', __('所有评论'));
blog('keywords', __('所有评论'));
blog('description', __('所有评论'));

template('comments');
?>